# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Victor Häggqvist <aur@snilius.com>

pkgname=python-pyfiglet
_name=${pkgname#python-}
pkgver=1.0.2
pkgrel=1
pkgdesc='Pure-python FIGlet implementation'
url=https://github.com/pwaller/pyfiglet
license=('GPL')
arch=('any')
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=('figlet' 'python-pytest' 'toilet')
source=("git+$url.git#tag=v$pkgver")
b2sums=('SKIP')

build() {
  cd "$_name"
  mkdir pyfiglet/fonts
  cp pyfiglet/fonts-standard/* pyfiglet/fonts
  cp pyfiglet/fonts-contrib/* pyfiglet/fonts
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd "$_name"
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  PYTHONPATH=. python pyfiglet/test.py
  PATH="$PWD/test-env/bin:$PATH" test-env/bin/python -m pytest
}

package() {
  cd "$_name"
  python -m installer --destdir="$pkgdir" dist/*.whl
}
